package testRankers;

import java.util.Arrays;

import org.junit.Test;

import vsvm.data.filter.ranking.AbstractRankingFilter;
import vsvm.data.filter.ranking.LaplacianScore;
import vsvm.data.model.AbstractDataModel;

public class LaplacianScoreTest extends AbstractRankerTest{

	@Test
	public void testScore() 
	{
		AbstractDataModel dataModel = getDataModel(mainPath + "data1", 0);

		double[] correct = {35.294117647058826, 
							22.371040723981906, 
							 0.0,
							 0.0,
						   };
		double[] correct2 = {14.117647058823529, 
							  9.502262443438914, 
							  0.0,
							  0.0,
						    };
		double[] correct3 = {60.0, 
							  7.105427357601002E-15, 
							  0.0,
							  0.0,
						     };
		double[] correct4 = {10.588235294117647, 
							  2.28054298642534, 
							  0.0,
							  0.0,
						     };
		
		AbstractRankingFilter ranker = new LaplacianScore(0, 2, 0, 
												LaplacianScore.nearestNeighbor);
		ranker.setDataModel(dataModel);
		assertTrue(Arrays.equals(correct, ranker.score()));
		
		AbstractRankingFilter ranker2 = new LaplacianScore(1.42, 0, 0, 
														LaplacianScore.epsilon);
		ranker2.setDataModel(dataModel);
		assertTrue(Arrays.equals(correct2, ranker2.score()));
		
		AbstractRankingFilter ranker3 = new LaplacianScore(0, 20, 0, 
												LaplacianScore.nearestNeighbor);
		ranker3.setDataModel(dataModel);
		assertTrue(Arrays.equals(correct3, ranker3.score()));
		
		AbstractRankingFilter ranker4 = new LaplacianScore(0, 20, 0, 
													  LaplacianScore.labelInfo);
		ranker4.setDataModel(dataModel);
		assertTrue(Arrays.equals(correct4, ranker4.score()));
	}

}
